package com.xlkj.listener;

import android.app.Activity;
import android.util.Log;
import android.widget.Toast;

import com.iflytek.cloud.ErrorCode;
import com.iflytek.cloud.InitListener;

public class IflytekInitListenerImpl implements InitListener {
    private Activity activity;
    private String TAG = "IflytekInitListenerImpl";
    public IflytekInitListenerImpl(Activity activity){
        this.activity = activity;
    }

    @Override
    public void onInit(int code) {
        Log.d(TAG, "InitListener init() code = " + code);
        if (code != ErrorCode.SUCCESS) {
            Toast.makeText(activity, "初始化失败,错误码"+code, Toast.LENGTH_SHORT).show();
//                showTip("初始化失败,错误码："+code);
        } else {
            // 初始化成功，之后可以调用startSpeaking方法
            // 注：有的开发者在onCreate方法中创建完合成对象之后马上就调用startSpeaking进行合成，
            // 正确的做法是将onCreate中的startSpeaking调用移至这里
        }
    }
}
